package Models;

import Backend.PrinterAgent_colour;
import java.io.IOException;
import java.util.Random;

/**
 *
 * @author ConorMcEvoy
 */
public class PrinterModel {

    private PrinterAgent_colour agent;
    private int jobscomplete = 0;
    private String printerIP;
    private String port;
    private String status;

    public PrinterModel() {
    }

    public PrinterModel(String IP) {

        this.printerIP = IP;
    }

    public PrinterModel(Random rand, int id, String porty, String device, int serial, String stat, int capacity) throws IOException {

        agent = new PrinterAgent_colour(rand, id, "0.0.0.0/" + porty, device, "" + serial, capacity);
        agent.start();
        this.printerIP = "udp:127.0.0.1/" + porty;
        this.port = porty;
        this.status = stat;
    }

    public String Get_Port() {

        return this.port;
    }

    public void addjob() {

        jobscomplete++;
    }

    public void setjob(int jobs) {

        jobscomplete = jobs;
    }

    public void deletejob() {

        if (jobscomplete > 0) {
            jobscomplete--;
        }
    }

    public String getIP() {
        return this.printerIP;

    }

    public int getJobs() {

        return this.jobscomplete;
    }
}
